package com.baizhi.springcloud.service;

import com.baizhi.springcloud.pojo.Dept;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;


import java.util.List;
//降级
@Component
public class DeptClientServiceFallbackFactory implements FallbackFactory {
    public Object create(Throwable cause) {

        return new DeptClientService() {

            public Dept queryById(Integer id) {
                return new Dept().setDeptno(id).setDname("id=>"+id+"没有对应信息，客户端提供降级信息，这个服务已经关闭");
            }

            public List<Dept> queryAll() {
                return null;
            }

            public boolean addDept(Dept dept) {
                return false;
            }
        };
    }
}
